export interface CacheStore {
  has(key: string): Promise<boolean>;
  set<T>(key: string, ...values: T[]): Promise<void>;
  get<T>(key: string): Promise<T>;
  // 其他字段
}

export function useCacheStore(isPersitst: boolean): CacheStore {
  if (!isPersitst) {
    return createMemoryStore();
  } else {
    return createStorageStore();
  }
}

function createMemoryStore() {
  return {
    has(key: string): Promise<boolean> {
      return new Promise((resolve, reject) => {});
    },
    set<T>(key: String, ...values: T[]): Promise<void> {
      return new Promise((resolve, reject) => {});
    },
    get<T>(key: string): Promise<T> {
      return new Promise((resolve, reject) => {});
    },
  };
}

function createStorageStore() {
  return {
    has(key: string): Promise<boolean> {
      return new Promise((resolve, reject) => {});
    },
    set<T>(key: String, ...values: T[]): Promise<void> {
      return new Promise((resolve, reject) => {});
    },
    get<T>(key: string): Promise<T> {
      return new Promise((resolve, reject) => {});
    },
  };
}
